<!--
 * @Author: your name
 * @Date: 2022-01-12 09:51:03
 * @LastEditTime: 2022-01-12 10:17:38
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \operation-management-systems\src\views\land-manage\components\selcetButton\index.vue
-->
<template>
  <div class="butt-list-sty">
    <div
      v-for="(item, index) in topitemSelectList"
      :key="item.groupId"
      :class="index === itemtypeactive ? 'basebut1' : 'basebut2'"
      @click="itemtypeactive = index"
    >
      {{ item.equipmentName }}
    </div>
  </div>
</template>

<script>
// import equipmentTypeManage from "@/api/digital-operation/equip-fac-manage/equip-type-manage";
export default {
  data() {
    return {
      itemtypeactive: 0,
      topitemSelectList: [
        { groupId: false, equipmentName: "当前设施" },
        { groupId: true, equipmentName: "历史设施" }
      ]
    };
  },
  watch: {
    itemtypeactive(newvalue) {
      this.selbut(newvalue);
    }
  },
  created() {},
  mounted() {
    this.selbut(0);
  },
  methods: {
    selbut(i) {
      // setTimeout(() => {
      // console.log(i)
      // console.log(this.topitemSelectList[i]["equipmentTypeId"])
      this.$emit("topitemtype", this.topitemSelectList[i]["groupId"]);
      // }, 1200)
    }
    // async queryEquipmentTypeList() {
    //   const { data: res } = await equipmentTypeManage.queryEquipmentList();
    //   this.topitemSelectList = res;
    //   // console.log(this.topitemSelectList)
    // }
  }
};
</script>
<style lang="scss" scoped>
.butt-list-sty {
  width: 100%;
  // height: 40px;
  // position: absolute;
  // top: 0;
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  // margin: 10px 0;
}
.basebut1 {
    width: 120px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    // background-color: transparent;
    background-image: linear-gradient(#0fa1d2,#1087af,#106f8f);
    border: #f6f9f9 1px solid;
    border-radius: 15px;
    color: #ffffff;
    cursor: pointer;
    margin: 3px 5px;
    // transform: translateY(50%);
}
.basebut2 {
    width: 120px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background-color: #106986;
    border-radius: 15px;
    color: #ffffff;
    cursor: pointer;
    margin: 3px 5px;
    padding-left: 10px;
    padding-right: 10px;
    // transform: translateY(50%);
}
</style>
